﻿

using IotContract.Dtos.Servers;
using IotContract.Events;
using IotContract.Models.Clients;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IotContract.Interfaces;

/// <summary>
/// 设备操作
/// </summary>
public interface IEquipOperation<T>:IDisposable where T : IotEquipDto
{
   
    /// <summary>
    /// 连接异常事件
    /// </summary>
    event EventHandler<ConnectStatusEventArgs> OnConnectStatusChanged;
    /// <summary>
    /// 轮询状态
    /// </summary>
    bool GetOperationStatus();
    /// <summary>
    /// 获取连接状态
    /// </summary>
    /// <returns></returns>
    bool GetConnection();
    

   
    /// <summary>
    /// 获取设备信息
    /// </summary>
    /// <returns></returns>
    T GetEquipInfo();
   /// <summary>
   /// 初始化数据
   /// </summary>
   /// <param name="group">设备</param>
   /// <param name="tags">点位</param>
   /// <returns></returns>
    Task<bool> Init(T group, IEnumerable<EquipTagDto> tags = null);

    /// <summary>
    /// 启动
    /// </summary>
    Task<bool> OperationStart();
    /// <summary>
    /// 开始
    /// </summary>
    Task<bool> OperationStop();
    /// <summary>
    /// 读取数据
    /// </summary>
    /// <param name="writeInfo"></param>
    Task<bool> WriteRequest(OperationWriteCommand writeInfo);


}
